package cn.echase.ecare.yinfayun.controller.statistics;

import cn.echase.common.result.aop.EchaseResponseResult;
import cn.echase.ecare.yinfayun.domain.dto.ElderStatisticsDto;
import cn.echase.ecare.yinfayun.domain.dto.StatisticsDto;
import cn.echase.ecare.yinfayun.domain.vo.CareLevelStatisticVo;
import cn.echase.ecare.yinfayun.domain.vo.OrgElderCenterVo;
import cn.echase.ecare.yinfayun.service.ICareLevelStatisticService;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.satoken.utils.LoginHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 照护等级统计
 * */
@Slf4j
@RestController
@EchaseResponseResult
@RequestMapping("/careLevel/statistic")
public class CareLevelStatisticController {

    @Autowired
    private ICareLevelStatisticService careLevelStatisticService;

    @RequestMapping(value = "pageList", method = RequestMethod.POST)
    @Log(title = "查询", businessType = BusinessType.OTHER)
    public TableDataInfo<CareLevelStatisticVo> getCareLevelStatisticPageList(@RequestBody StatisticsDto statisticsDto) {
        statisticsDto.setOrgId(LoginHelper.getOrgId());
        statisticsDto.setTenantId(LoginHelper.getOrgId());
        return careLevelStatisticService.careLevelStatisticPageList(statisticsDto);
    }

    @RequestMapping(value = "list", method = RequestMethod.GET)
    @Log(title = "查询", businessType = BusinessType.OTHER)
    public List<CareLevelStatisticVo> getCareLevelStatisticList() {
        StatisticsDto statisticsDto = new StatisticsDto();
        statisticsDto.setOrgId(LoginHelper.getOrgId());
        statisticsDto.setTenantId(LoginHelper.getOrgId());
        return careLevelStatisticService.careLevelStatisticList(statisticsDto);
    }

    @RequestMapping(value = "elderList", method = RequestMethod.POST)
    @Log(title = "查询", businessType = BusinessType.OTHER)
    public TableDataInfo<OrgElderCenterVo> getCareLevelElderList(@RequestBody ElderStatisticsDto elderStatisticsDto) {
        elderStatisticsDto.setOrgId(LoginHelper.getOrgId());
        return careLevelStatisticService.getCareLevelElderList(elderStatisticsDto);
    }

}
